Implemented a scheduler based on agenda and modified the Tool execute interface to adapt#150
Merged
Myriad-Dreamin merged 16 commits intoEmaFanClub:mainfrom Feb 8, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Implements an Agenda-backed job scheduler in packages/ema (including server integration) and refactors the tool/skill execution interface to support structured args plus optional execution context.
Changes:
- Add
AgendaSchedulerwith job handler registry, plus comprehensive scheduler tests. - Introduce
ToolContext/ActorScopeand switch tool execution from positional args to{...args}payloads. - Patch
@hokify/agendato work alongside MongoDB v7 by using an aliased MongoDB v4 dependency (mongodb-agenda).
Reviewed changes
Copilot reviewed 33 out of 34 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-workspace.yaml | Adds pnpm patchedDependencies entry for Agenda patching. |
| pnpm-lock.yaml | Locks new dependencies for Agenda + MongoDB aliasing and updated transitive graph. |
| patches/@hokify__agenda@6.3.0.patch | Patches Agenda to import from mongodb-agenda instead of mongodb. |
| packages/ema/src/tools/mini_agent/skill_tool.ts | Removes legacy mini-agent skill tool implementation. |
| packages/ema/src/tools/mini_agent/skill_loader.ts | Removes legacy mini-agent skill loading implementation. |
| packages/ema/src/tools/mini_agent/note_tool.ts | Removes legacy mini-agent note tools. |
| packages/ema/src/tools/mini_agent/mcp_loader.ts | Removes legacy MCP tool loader implementation. |
| packages/ema/src/tools/mini_agent/file_tools.ts | Removes legacy file tools implementation. |
| packages/ema/src/tools/mini_agent/bash_tool.ts | Removes legacy bash tool implementation. |
| packages/ema/src/tools/get_skill_tool.ts | Updates tool execute signature to (args, context?) and validates args via zod. |
| packages/ema/src/tools/exec_skill_tool.ts | Updates tool execute signature and renames payload field to skill_args. |
| packages/ema/src/tools/ema_reply_tool.ts | Updates tool execute signature to accept a single args object. |
| packages/ema/src/tools/base.ts | Adds ToolContext and changes Tool.execute contract to (args, context?). |
| packages/ema/src/tests/tools/get_skill_tool.spec.ts | Updates tests to call tools with args objects. |
| packages/ema/src/tests/tools/exec_skill_tool.spec.ts | Updates tests for new args shape and execution signature. |
| packages/ema/src/tests/tools/ema_reply_tool.spec.ts | Updates tests to call EmaReplyTool with a single args object. |
| packages/ema/src/tests/scheduler.spec.ts | Adds test coverage for schedule/cancel/reschedule and recurring jobs. |
| packages/ema/src/skills/demo-skill/index.ts | Updates skill execute signature to (args, context?). |
| packages/ema/src/skills/base.ts | Updates base skill execute signature (and adds context types). |
| packages/ema/src/server.ts | Creates and starts the scheduler; includes its collection in snapshots. |
| packages/ema/src/scheduler/scheduler.ts | Implements AgendaScheduler (start/stop/schedule/cancel/reschedule). |
| packages/ema/src/scheduler/jobs/test.job.ts | Adds a demo job handler and typed job payload. |
| packages/ema/src/scheduler/jobs/index.ts | Introduces JobDataMap and the jobHandlers mapping. |
| packages/ema/src/scheduler/index.ts | Exports scheduler modules. |
| packages/ema/src/scheduler/base.ts | Defines scheduler domain types and the Scheduler interface. |
| packages/ema/src/db/mongo/remote.ts | Adds getUri() to support Agenda database connection setup. |
| packages/ema/src/db/mongo/memory.ts | Adds getUri() and adjusts memory server creation options. |
| packages/ema/src/db/mongo.ts | Adds abstract getUri() contract to Mongo base class. |
| packages/ema/src/agent.ts | Switches tool execution to pass (callArgs, toolContext) instead of positional args. |
| packages/ema/src/actor.ts | Adds ActorScope and injects it into toolContext for agent runs. |
| packages/ema/package.json | Adds @hokify/agenda and mongodb-agenda dependencies. |
| packages/ema-ui/src/app/chat/page.tsx | Adds initialization gating + in-module caching for initial history load, and a unified notice banner. |
| packages/ema-ui/src/app/chat/page.module.css | Updates notice styling to a fixed “toast” banner. |
| packages/ema-ui/package.json | Adds mongodb-agenda dependency. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This was
linked to
issues
Jan 27, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…and update ToolContext to include Server
Myriad-Dreamin
approved these changes
Feb 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #112 #113 #114 #115 #116 #117
This pull request introduces a new Agenda-backed job scheduling system to the EMA codebase, along with improvements to the chat UI and various supporting updates. The main changes include the addition of typed scheduler interfaces and job definitions, refactoring of the chat page to improve status handling and initialization, and enhancements to MongoDB connection handling. Below are the most important changes grouped by theme:
Scheduler System Integration
src/scheduler/base.ts. This establishes a stable API for scheduling and managing jobs.src/scheduler/jobs/index.ts, including a demo job and handler insrc/scheduler/jobs/test.job.ts. [1] [2]src/scheduler/index.ts.Chat UI Improvements
src/app/chat/page.tsxandpage.module.css) to use a unifiednoticestate for displaying status messages, improved initialization logic with caching, and updated UI styles for better feedback and accessibility. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]MongoDB Enhancements
getUri()methods to both in-memory and remote MongoDB classes to provide connection URIs, improving testability and integration with external tools. [1] [2] [3] [4] [5]Actor and Agent Context Improvements
ActorScopeand passed contextual information throughtoolContext, enabling tools to access actor, user, and conversation IDs during execution. [1] [2] [3] [4] [5]Dependency Updates
@hokify/agenda,mongodb-agenda) inpackage.jsonfiles for bothemaandema-uipackages. [1] [2] [3]